/// 用户模型
class UserModel {
  final String id;
  final String account;
  final String password;
  final String userName;
  final String avatar;

  const UserModel({
    required this.id,
    required this.account,
    required this.password,
    required this.userName,
    required this.avatar,
  });

  /// 从JSON创建用户模型
  factory UserModel.fromJson(Map<String, dynamic> json) {
    return UserModel(
      id: json['id'] ?? '',
      account: json['account'] ?? '',
      password: json['password'] ?? '',
      userName: json['userName'] ?? '',
      avatar: json['avatar'] ?? '',
    );
  }

  /// 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'account': account,
      'password': password,
      'userName': userName,
      'avatar': avatar,
    };
  }
}
